package com.fusetech.flow.audit.service.mapstruct;


import com.fusetech.flow.audit.domain.CurrentAuditNode;
import com.fusetech.flow.audit.service.dto.CurrentAuditNodeDTO;
import com.fusetech.os.core.mapstruct.EntityWrapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 * CurrentAuditNodeWrapper
 *
 * @author Liuwq
 * @version 2023-05-10
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
public interface CurrentAuditNodeWrapper extends EntityWrapper<CurrentAuditNodeDTO, CurrentAuditNode> {

    CurrentAuditNodeWrapper INSTANCE = Mappers.getMapper(CurrentAuditNodeWrapper.class);

    @Mappings({
            @Mapping(source = "nextNode.id", target = "nextNodeId"),
            @Mapping(source = "auditNode.id", target = "auditNodeId"),
            @Mapping(source = "auditProcess.id", target = "auditProcessId"),
            @Mapping(source = "createBy.userId", target = "createBy"),
            @Mapping(source = "updateBy.userId", target = "updateBy")
//            @Mapping(source = "org.id", target = "orgId"),
//            @Mapping(source = "office.id", target = "officeId"),
//            @Mapping(source = "post.id", target = "postId")
    })
    CurrentAuditNode toEntity(CurrentAuditNodeDTO dto);


    @Mappings({
            @Mapping(source = "nextNodeId", target = "nextNode.id"),
            @Mapping(source = "auditNodeId", target = "auditNode.id"),
            @Mapping(source = "auditProcessId", target = "auditProcess.id"),
            @Mapping(source = "createBy", target = "createBy.userId"),
            @Mapping(source = "updateBy", target = "updateBy.userId")
//            @Mapping(source = "orgId", target = "org.id"),
//            @Mapping(source = "officeId", target = "office.id"),
//            @Mapping(source = "postId", target = "post.id")
    })
    CurrentAuditNodeDTO toDTO(CurrentAuditNode entity);
}

